﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace iClassAddin
{
    public partial class iVCForm : Form
    {
        public iVCForm()
        {
            InitializeComponent();
        }

        private void ButtonOK_Click(object sender, EventArgs e)
        {
            iCreateClassData createData = new iCreateClassData();
            createData.isInline = checkInline.Checked;
            createData.isVirtual = checkVirtual.Checked;
            createData.isMakeCpp = !checkMakeCpp.Checked;
            createData.className = ClassNameText.Text;
            createData.headerName = HeaderText.Text;
            createData.cppName  = CppText.Text;
            createData.inlineName = ClassNameText.Text + ".inl";
            if( parentClass.Text.Length > 0 )
                createData.parentName = comboAccess.Text + " " + parentClass.Text;

            iVcClassProject projEngine = new iVcClassProject();
            bool ret = projEngine.Create(createData);

            //iVcProjectEngine ProjEngine = (iVcProjectEngine)iVcEngine.CreateEngine(this);
            //if (EngineModlue.Checked)
            //{
            //    bool ret = ProjEngine.CreateModuleProject(ProjectNameBox.Text);
            //    iMessageBox.DecideMessageBox(ret, "Failed Create Module Project");
            //    if (!ret)
            //        return;


            //}
            //else if (GameSample.Checked)
            //{
            //    //if (!Engine.CreateModuleProject())
            //    //    MessageBox.Show("Failed Create Module Project");
            //}

            //if (EngineModlue.Checked)
            //{
            //    iVcModuleProject projEngine = new iVcModuleProject();
            //    bool ret = projEngine.Create(ProjectNameBox.Text);
            //}
            //else if (GameSample.Checked)
            //{
            //    iVCSampleProject projEngine = new iVCSampleProject();
            //    bool ret = projEngine.Create(ProjectNameBox.Text);
            //}
            Close();
        }

        public static Form CreateFunction()
        {
            return new iVCForm();
        }

        private void ButtonCancle_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void ClassNameChanged(object sender, EventArgs e)
        {
            String className = classNameText.Text;
            if(className.IndexOf("C",0 ) != -1)
            {
               className = className.Remove(0, 1);
            }

            headerText.Text = className+".h";
            cppText.Text = className+".cpp";
        }
    }
}
